/**
 * Created by zhaoyanzhi on 16-9-9.
 */
app.controller("paymentPageCtrl",function($scope,$location,$filter){
    $scope.jumpHomePage=function(){
        $location.path("/")
    };
    $scope.jumpShoppingListPage= function(){
        $location.path("/productListPage")
    };
    $scope.date= new Date();
    $filter("date")($scope.date, "yyyy年MM月dd日 HH:mm:ss");
    $scope.showCartCount=function(){
        var shoppingCart =new ShoppingCart();
        var cartCount=shoppingCart.computeSumCount();
        $scope.cartCount = cartCount||0;
        if(cartCount==0){
            $scope.jumpShoppingListPage();
        }
    };
    var goodsInfo=JSON.parse(localStorage.getItem("goodsInfo"))||{};
    $scope.cartList=goodsInfo.cartList;
    $scope.showSumPrice=function(){
        var shoppingCart =new ShoppingCart();
        var sumPrice=shoppingCart.computeSumPrice();
        $scope.sumPrice=sumPrice;
    };
    $scope.showSumSavePrice=function(){
        var shoppingCart =new ShoppingCart();
        var sumSavePrice=shoppingCart.computeSumSaveParice();
        $scope.savePrice=sumSavePrice;
    };
    $scope.addButtonEvent=function(){
        $scope.jumpShoppingListPage();
        localStorage.clear();
    }
    })

